﻿<!DOCTYPE html>
<head>
    <title>worker</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script>
            function init(){
                //创建一个Worker对象，并向它传递将在新线程中执行的脚本url
               
                var worker = new Worker('worker.js');
                //接收worker传递过来的数据
                worker.onmessage = function(event){
                    document.getElementById('result').innerHTML+=event.data+"<br/>" ;
                };
                console.log("33");
            };
    </script>
</head>
<body onload="init()">
    <div id="result"></div>
</body>
</html>